[][src]Crate ruspiro_gpio

Raspberry Pi GPIO access abstraction

This crate provide as simple to use and safe abstraction of the GPIO's available on the Raspberry Pi 3. The GPIO configuration requires access to MMIO registers with a specific memory base address. As this might differ between different models the right address is choosen based on the given ruspiro_pi3 feature while compiling.

Usage

The crate provides a singleton accessor to the GPIO peripheral and it's pin to be used in a safe manner like this:

use ruspiro_gpio::GPIO;
 
fn demo() {
    GPIO.take_for(|gpio| {
        let pin = gpio.get_pin(17).unwrap(); // assuming we can always get this pin as it is not in use already
        pin.to_output().high(); // set this pin to high - this may lit a connected LED :)
    });
}

Features

  • ruspiro_pi3 is active by default and ensures the proper MMIO base memory address is used for Raspberry Pi 3

Re-exports

pub use self::pin::*;

Modules

pin

Definition of GPIO Pins

Structs

Gpio

GPIO peripheral representation

Statics

GPIO

Static "singleton" accessor to the GPIO peripheral